package com.example.demo.service;

import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class LoginaService {
    @Autowired
    private UserMapper userMapper;


    @Transactional
    public User loginCheck(String username, String password) {
        return userMapper.loginUser(username,password);
    }


    public boolean checkCode(String sessionCode,String intputCode){
        System.out.println(sessionCode+intputCode);
        if (sessionCode.equals(intputCode)){
            return true;
        }else
            return false;
    }

    public User usernameIfExist(String username) {
        return userMapper.usernameIfExist(username);
    }

    public int loginCheckState(String username) {
        return userMapper.loginCheckState(username);
    }
}